﻿Imports System.Data.OleDb
Public Class browsec
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
    Protected Sub searchResults_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
        If searchResults.Items.Count < 1 Then
            If e.Item.ItemType = ListItemType.Footer Then
                Dim lblFooter As Label = CType(e.Item.FindControl("lblEmptyData"), Label)
                lblFooter.Visible = True
            End If
        End If
    End Sub
    Protected Sub submitadvancedsearch_Click(sender As Object, e As EventArgs) Handles submitadvancedsearch.Click
        Dim conn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("BookMeetConnString").ConnectionString)
        conn.Open()
        Dim cmdsearch As New OleDbCommand("SELECT * FROM bookclubs WHERE (BookClubName LIKE '%' + ? + '%') ", conn)
        cmdsearch.Parameters.AddWithValue("@username", other.Text)
        searchResults.DataSource = cmdsearch.ExecuteReader()
        searchResults.DataBind()
        conn.Close()
    End Sub
    Protected Sub submitregionsearch_Click(sender As Object, e As EventArgs) Handles submitregionsearch.Click
        Dim conn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("BookMeetConnString").ConnectionString)
        conn.Open()
        Dim cmdsearch As New OleDbCommand("SELECT * FROM bookclubs WHERE (BookClubLocation = ?) ", conn)
        cmdsearch.Parameters.AddWithValue("@region", dd_userlocation.SelectedValue)
        searchResults.DataSource = cmdsearch.ExecuteReader()
        searchResults.DataBind()
        conn.Close()
    End Sub
End Class